#!/usr/bin/env bash
#
# Updates the version number in a .csproj file
# There must be a .releasable file next to the .csproj file
# so the script knows which one to update.
#

releaseable_file=$(find . -type f -name "*.releaseable")
releaseable_dir=$(dirname ${releaseable_file})
csproj_file=$(find ${releaseable_dir} -type f -name "*.csproj")

xmlstarlet ed --inplace --ps \
  --update "/Project/PropertyGroup/VersionNumber" \
  --value "${NEW_VERSION}" \
  "${csproj_file}"
